home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 026-050 / scopedisk33 / fortune / fortune.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-18  |  616b  |  27 lines

  1. /* fortune.rexx -- print out a fortune from the fortune file */
  2.  
  3. /* change the filename here to reflect where the 'fortune.data file is' */
  4.  
  5. datafile = 'db:fortune.data'
  6.  
  7. dummy = addlib('rexxsupport.library',0,-30,0)
  8. dummy = time('S')
  9. call randu(dummy)
  10. say
  11.  
  12. if open(infile,datafile,'R') = 1 then do
  13.   fortsize = word(statef(datafile),2)
  14.   pick = randu()*140278
  15.   pick = delstr(pick,pos('.',pick))
  16.   dummy = seek(infile,pick,'B')
  17.   instring = readln(infile)
  18.   do until left(instring,1,1) = '~'
  19.     instring = readln(infile)
  20.   end
  21.   do i = 1 to word(instring,2)
  22.     say readln(infile)
  23.   end
  24. end
  25. say
  26. call close(infile)
  27.